home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Demo 1.2 Source / MSG Demo ƒ / Demo code / demo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-10  |  4.8 KB  |  109 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        demo.c
  4.  
  5. Purpose:    This module handles demo initialization/shutdown and a
  6.             dispatch for the graphic effects.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-3 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "demo.h"
  30. #include "msg graphics.h"
  31.  
  32. PicHandle        gPict1;
  33. PicHandle        gPict2;
  34. PicHandle        gPict3;
  35. PicHandle        gPict4;
  36. Boolean            gWhichPict;
  37. int                gWhichWipe;
  38. int                gLastWipe;
  39.  
  40. void InitProgram(void)
  41. {
  42.     gPict1 = GetPicture(200);
  43.     gPict2 = GetPicture(201);
  44.     gPict3 = GetPicture(202);
  45.     gPict4 = GetPicture(203);
  46.     
  47.     gWhichWipe=0;
  48.     gLastWipe=-1;
  49.     gMainWindow=0L;
  50.     gInitedWindowBounds=FALSE;
  51.     OpenMainWindow();
  52. }
  53.  
  54. void ShutDownProgram(void)
  55. {
  56.     if(gPict1)
  57.         ReleaseResource(gPict1);
  58.     if(gPict2)
  59.         ReleaseResource(gPict2);
  60.     if(gPict3)
  61.         ReleaseResource(gPict3);
  62.     if(gPict4)
  63.         ReleaseResource(gPict4);
  64. }
  65.  
  66. void DemoDoWipe(GrafPtr myGrafPtr)
  67. {
  68.     ObscureCursor();
  69.     gWhichPict = !gWhichPict;
  70.     switch(gWhichWipe)
  71.     {
  72.         case 1:        BoxOutWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  73.         case 2:        RandomWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  74.         case 3:        SpiralGyra(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  75.         case 4:        CircularWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  76.         case 5:        CasteWipeRL(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  77.         case 6:        FourCorner(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  78.         case 7:        BoxInWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  79.         case 8:        RippleWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  80.         case 9:        DissolveWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  81.         case 10:    DiagonalWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  82.         case 11:    CasteWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  83.         case 12:    HilbertWipeCall(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);        break;
  84.         case 13:    SlideWipe(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  85.         case 14:    Skipaline(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  86.         case 15:    SkipalineLR(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  87.         case 16:    Scissors(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);                break;
  88.         case 17:    RescueRaiders(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);        break;
  89.         case 18:    FourCornerCentered(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);    break;
  90.         case 19:    TwoCorner(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  91.         case 20:    CircleOut(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  92.         case 21:    CircleIn(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);                break;
  93.         case 22:    CircleSerendipity(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);    break;
  94.         case 23:    CircleBulge(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  95.         case 24:    CornerCircle(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  96.         case 25:    FullScrollLR(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  97.         case 26:    FullScrollUD(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  98.         case 27:    MrDo(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);                    break;
  99.         case 28:    MrDoOutdone(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  100.         case 29:    SplitScrollUD(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);        break;
  101.         case 30:    FourCornerScroll(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);        break;
  102.         case 31:    HalvesScroll(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  103.         case 32:    PourScroll(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  104.         default:    CornerCircle(myGrafPtr, (GrafPtr)gMainWindow, gWindowHeight, gWindowWidth);            break;
  105.     }
  106.     gLastWipe=gWhichWipe;
  107.     gWhichWipe=0;
  108. }
  109.